package com.ykt.controller;

import com.jfinal.aop.Before;
import com.ykt.service.CaptchaService;
import com.ykt.validator.CommonValidator;
import com.ykt.vo.ResultVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 个人手机获取短信验证码操作
 * @author wing
 * @version 1.0.0
 */
public class CaptchaController extends BaseController{
    private final static Logger LOGGER = LoggerFactory.getLogger(CaptchaController.class);


    private CaptchaService captchaService = enhance(CaptchaService.class.getName(), CaptchaService.class);


    @Before(CommonValidator.PhoneValidator.class)
    public void create(){
    	// 获取参数
    	String phone = getPara("phone");
        LOGGER.info("请求手机号是：{}", phone);

        // 发送短信
        captchaService.sendSms(phone);

        // 返回数据
        this.returnJson(ResultVo.success());

    }

}
